package com.th.supcom.pds.impl.manager.impl;

import java.util.List;
import java.util.Map;

import net.carefx.fc.framework.db.manager.GetSequenceHelper;

import org.apache.ibatis.session.RowBounds;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.th.supcom.pds.domain.pojo.PdsSupply;
import com.th.supcom.pds.domain.vo.PdsSupplyVO;
import com.th.supcom.pds.impl.dao.PdsSupplyMapper;
import com.th.supcom.pds.impl.manager.PdsSupplyManager;

/**
 * PdsSupply 管理接口实现.
 * 
 * 供药单主表.
 */
public class PdsSupplyManagerImpl implements PdsSupplyManager
{
    public static final String TAB_PDS_SUPPLY = "PDS_SUPPLY";

    private PdsSupplyMapper m_pdsSupplyMapper;
    /** 序列生成器. */
    private GetSequenceHelper m_getSequenceHelper;

    /**
     * 默认的构造函数.
     */
    public PdsSupplyManagerImpl ()
    {

    }

    /**
     * 获取PdsSupplyMapper.
     * 
     * @return PdsSupplyMapper.
     */
    public PdsSupplyMapper getPdsSupplyMapper ()
    {
        return m_pdsSupplyMapper;
    }

    /**
     * 注入PdsSupplyMapper.
     * 
     * @param pdsSupplyMapper set pdsSupplyMapper.
     */
    public void setPdsSupplyMapper (PdsSupplyMapper pdsSupplyMapper)
    {
        m_pdsSupplyMapper = pdsSupplyMapper;
    }

    /**
     * 获取序列.
     * 
     * @return GetSequenceHelper
     */
    public GetSequenceHelper getGetSequenceHelper ()
    {
        return m_getSequenceHelper;
    }

    /**
     * 注入序列.
     * 
     * @param getSequenceHelper getSequenceHelper.
     */
    public void setGetSequenceHelper (GetSequenceHelper getSequenceHelper)
    {
        m_getSequenceHelper = getSequenceHelper;
    }

    @Override
    public PdsSupply getPdsSupplyByID (Long id)
    {
        return m_pdsSupplyMapper.getPdsSupplyByID (id);
    }

    @Override
    public Long getPdsSupplySeq ()
    {
        return m_getSequenceHelper.getNextSequenceId (TAB_PDS_SUPPLY);
    }

    @Override
    public List <PdsSupply> findPdsSupplyListByExample (PdsSupply pdsSupply)
    {
        return m_pdsSupplyMapper.findPdsSupplyListByExample (pdsSupply);
    }

    @Override
    public int findPdsSupplyCountByExample (PdsSupply pdsSupply)
    {
        return m_pdsSupplyMapper.findPdsSupplyCountByExample (pdsSupply);
    }

    @Override
    public List <PdsSupply> findPdsSupplyListByMap (Map <String, Object> params)
    {
        return m_pdsSupplyMapper.findPdsSupplyListByMap (params);
    }

    @Override
    public List <PdsSupply> findPdsSupplyListWithPageByMap (Map <String, Object> params, Integer offset, Integer limit)
    {
        return m_pdsSupplyMapper.findPdsSupplyListWithPageByMap (new RowBounds (offset, limit), params);
    }

    @Override
    public Integer findPdsSupplyCountByMap (Map <String, Object> params)
    {
        return m_pdsSupplyMapper.findPdsSupplyCountByMap (params);
    }

    @Override
    public int modifyPdsSupply (PdsSupply pdsSupply)
    {
        return m_pdsSupplyMapper.modifyPdsSupply (pdsSupply);
    }

    @Override
    public int modifyPdsSupplyByExample (PdsSupply pdsSupply)
    {
        return m_pdsSupplyMapper.modifyPdsSupplyByExample (pdsSupply);
    }

    @Override
    public int removePdsSupplyByID (Long id)
    {
        return m_pdsSupplyMapper.removePdsSupplyByID (id);
    }

    @Override
    public int removePdsSupplyByMap (Map <String, Object> params)
    {
        return m_pdsSupplyMapper.removePdsSupplyByMap (params);
    }

    @Override
    public Long addPdsSupply (PdsSupply pdsSupply)
    {
        Long id = getPdsSupplySeq ();
        pdsSupply.setSupplyId (id);
        m_pdsSupplyMapper.addPdsSupply (pdsSupply);
        return id;
    }

    /** 日志记录器. */
    public static final Logger s_logger = LoggerFactory.getLogger (PdsSupplyManagerImpl.class);

    /** 公司版权信息. */
    public static final String copyright = "Copyright 2015, TH Supcom Corporation";

    /** 提交路径. */
    public static final String SCC_BRANCH = "$URL$";

    /** 提交日期. */
    public static final String SCC_LAST_MODIFICATION_DATE = "$Date$";

    /** 最终修改人员. */
    public static final String SCC_LAST_MODIFIER_NAME = "$Author$";

    /** 最终版本号. */
    public static final String SCC_REVISION = "$Revision$";

    @Override
    public void insertBatchPdsSupply (List <PdsSupply> list)
    {
        s_logger.debug ("进入insertBatchPdsSupply方法,入参:list", new Object[]
        { list });
        // 得到主键
        Long id = getPdsSupplySeq ();
        // 给插入的对象设置主键
        for (PdsSupply pdsSupply : list)
        {
            pdsSupply.setSupplyId (id);
            id++;
        }
        m_pdsSupplyMapper.insertBatchPdsSupply (list);

    }

    @Override
    public List <PdsSupplyVO> findPdsSupplyListWithTotalPrice (Map <String, Object> params)
    {
        return m_pdsSupplyMapper.findPdsSupplyListWithTotalPrice (params);
    }
}